

#import "../sleipner_config.h"

#ifdef _PLATFORM_IOS


#import "ios_wrappers.h"

#ifdef _SDL2

    #import "SDL2/include/SDL.h"
    #import "SDL2/include/SDL_video.h"
    #import "SDL2/include/SDL_syswm.h"

#else

    #import "SDL-1.2.13/include/SDL.h"
    #import "SDL-1.2.13/include/SDL_video.h"
    #import "SDL-1.2.13/include/SDL_syswm.h"

#endif






const char*	GetUserDataSaveFolder(const char* Path)
{
	// IPHONE CODE SAMPLE
    
          
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *basePath = ([paths count] > 0) ? [paths objectAtIndex:0] : nil;
    Path = [basePath UTF8String];
    return (Path);
   	
}

/*
deprecated
void PresentModalView( const char* viewName )
{
   	SDL_SysWMinfo info;
	SDL_VERSION( &info.version );
    
    SDL_Window* window = SDL_GetFocusWindow();
	if( SDL_GetWindowWMInfo( window, &info ) )
	{
		UIWindow* uiWindow = (UIWindow*)info.info.uikit.window;
		UIView* view = [uiWindow.subviews objectAtIndex:0];
		id nextResponder = [view nextResponder];
		if( [nextResponder isKindOfClass:[UIViewController class]] )
		{
			UIViewController* viewController =
			(UIViewController*)nextResponder;
            
			// You can do some terrifying things with Objective-C
			NSString* className = [NSString stringWithUTF8String:viewName];
			Class ViewControllerClass = NSClassFromString(className);
			id subviewController = [[[ViewControllerClass alloc]
                                     initWithNibName:className bundle:nil] autorelease];
            
			[viewController presentModalViewController:
             subviewController animated:YES];
        }
	}
 
} 
 */

void    GotoWebSite( const char* URL )
{
    NSString *URL_Link  = [[NSString alloc] initWithUTF8String:URL];
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:URL_Link]]; 
}



#endif

